﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using Library;
using System.Windows.Forms;
using Microsoft.Reporting.WinForms;

namespace QLKH.View.report
{
    public partial class reportCQKoPhi : Form
    {
        public reportCQKoPhi()
        {
            InitializeComponent();
            this.Height = Screen.PrimaryScreen.WorkingArea.Height; //ConfigForm.height;
            this.Width = Screen.PrimaryScreen.WorkingArea.Width;//configForm.width
        }

        private void btquit_Click(object sender, EventArgs e)
        {
            this.Close();
        }

        private void reportCQKoPhi_Load(object sender, EventArgs e)
        {
            this.reportViewerCQKoPhi.RefreshReport();
        }

        private void btnLapBaoCao_Click(object sender, EventArgs e)
        {
            string ngaylap = dateview.Value.ToString("MM/dd/yyyy");
            clReport CQkp = new clReport();
            DataTable dt = CQkp.reportCQKophi(ngaylap);
            ReportDataSource rpkq = new ReportDataSource();
            rpkq.Name = "DatasetCQkoPNT";
            rpkq.Value = dt;

            this.reportViewerCQKoPhi.Reset();
            this.reportViewerCQKoPhi.LocalReport.ReportEmbeddedResource = "QLKH.View.report.BanKeBienLaiCQKoPhi.rdlc";
            this.reportViewerCQKoPhi.LocalReport.DataSources.Clear();
            this.reportViewerCQKoPhi.LocalReport.DataSources.Add(rpkq);

            IList<ReportParameter> param = new List<ReportParameter>();
            param.Add(new ReportParameter("Ngaylap", ngaylap));

            reportViewerCQKoPhi.LocalReport.SetParameters(param);

            this.reportViewerCQKoPhi.RefreshReport();
            //this.reportViewerCQKoPhi.ZoomPercent = 100;
            this.reportViewerCQKoPhi.SetDisplayMode(DisplayMode.PrintLayout);
            this.reportViewerCQKoPhi.ZoomMode = ZoomMode.Percent;
            this.reportViewerCQKoPhi.ZoomPercent = 100;
        }
    }
}
